# -*- coding: utf-8 -*-
"""
-------------------------------------------------
   File Name：     TestWelcome.py
   Description :
   Author :        ZhangYiLin
   date：          2020/12/03 15:32
-------------------------------------------------
   Change Activity:
                   2020/12/03 15:32
-------------------------------------------------
"""
from selenium.webdriver.common.by import By

from common.BasePage import BasePage


class Welcome(BasePage):
    """
    welcome页面
    """
    EmergencyContact = (
        By.XPATH,
        """//*[@id="mapBox"]/div[1]/div[3]/div""")  # 紧急联系人，点击此处用于触发流程
    ViewDisasterInformation = (
        By.XPATH,
        """/html/body/div[1]/div[2]/div/div/div[3]/span/button""")  # 查看预警信息
    InitiateLogisticsEmergencyResponse = (  # 启动后勤应急响应
        By.XPATH, """/html/body/div/div[2]/div[2]/div[2]/div[3]/p[2]""")

    def process_trigger(self):
        """
        流程触发
        """
        self.click_contactPerson()
        self.click_view_disaster_information()
        self.click_start_logistics_emergency_response()

    def click_contactPerson(self):
        """
        点击查看联系人
        """
        self.click(*self.EmergencyContact)

    def click_view_disaster_information(self):
        """
        查看预警信息
        :return:
        """
        self.click(*self.ViewDisasterInformation)

    def click_start_logistics_emergency_response(self):
        """
        启动后勤应急响应
        :return:
        """
        self.click(*self.InitiateLogisticsEmergencyResponse)


if __name__ == '__main__':
    # dri = Login()
    # dri.TestLogin('admin', 'add')
    #
    # driver = Welcome(dri)
    # driver.click_contactPerson()
    # driver.click_view_disaster_information()
    # driver.click_start_logistics_emergency_response()
    pass
